package com.chao.resource.controller;

import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author : Rookie
 * @description :
 * @date : 2022/1/27
 */
@Slf4j
@RestController
public class UserController {

    @Autowired
    private HttpServletRequest request;

    @GetMapping("/userInfo")
    public String currentUser(){
        String userInfo = request.getHeader("userInfo");
        log.info("current UserInfo:{}", JSONUtil.toJsonStr(userInfo));
        return userInfo;
    }

    @GetMapping("/hello")
    public String hello(){
        return "hello,oauth2";
    }
}
